home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / em7sui_1 / FRMPORTA.FR_ / FRMPORTA.FR
Text File  |  1999-01-07  |  65KB  |  1,700 lines

  1. VERSION 5.00
  2. Object = "{175D870F-94F1-11D2-9507-F44505C10000}#1.1#0"; "PORTALTEMPLATE.OCX"
  3. Begin VB.Form frmPortalTest 
  4.    Caption         =   "Graph builder"
  5.    ClientHeight    =   4035
  6.    ClientLeft      =   60
  7.    ClientTop       =   390
  8.    ClientWidth     =   3600
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   4035
  11.    ScaleWidth      =   3600
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin PortalTemplate.PortalTemplateCtl PortalTemplateCtl 
  14.       Left            =   2760
  15.       Top             =   180
  16.       _ExtentX        =   1085
  17.       _ExtentY        =   1085
  18.       ProtoPath       =   "..\..\..\ProtoPac\"
  19.    End
  20.    Begin VB.CommandButton cmdRCComboGraph 
  21.       Caption         =   "Make RC combo graph"
  22.       Height          =   375
  23.       Left            =   165
  24.       TabIndex        =   8
  25.       Top             =   3615
  26.       Width           =   2310
  27.    End
  28.    Begin VB.CommandButton cmdSCComboGraph 
  29.       Caption         =   "Make SC combo graph"
  30.       Height          =   375
  31.       Left            =   165
  32.       TabIndex        =   7
  33.       Top             =   3180
  34.       Width           =   2310
  35.    End
  36.    Begin VB.CommandButton cmdDensityGraph 
  37.       Caption         =   "Make density graph"
  38.       Height          =   375
  39.       Left            =   180
  40.       TabIndex        =   6
  41.       Top             =   2745
  42.       Width           =   2310
  43.    End
  44.    Begin VB.CommandButton cmdSurfaceGraph 
  45.       Caption         =   "Make surface graph"
  46.       Height          =   375
  47.       Left            =   180
  48.       TabIndex        =   5
  49.       Top             =   2280
  50.       Width           =   2310
  51.    End
  52.    Begin VB.CommandButton cmdScatterGraph 
  53.       Caption         =   "Make scatter graph"
  54.       Height          =   375
  55.       Left            =   165
  56.       TabIndex        =   4
  57.       Top             =   1845
  58.       Width           =   2310
  59.    End
  60.    Begin VB.CommandButton cmdPieGraph 
  61.       Caption         =   "Make pie graph"
  62.       Height          =   375
  63.       Left            =   165
  64.       TabIndex        =   3
  65.       Top             =   1395
  66.       Width           =   2310
  67.    End
  68.    Begin VB.CommandButton cmdColumnGraph 
  69.       Caption         =   "Make column graph"
  70.       Height          =   375
  71.       Left            =   150
  72.       TabIndex        =   2
  73.       Top             =   960
  74.       Width           =   2310
  75.    End
  76.    Begin VB.CommandButton cmdRibbonGraph 
  77.       Caption         =   "Make ribbon graph"
  78.       Height          =   375
  79.       Left            =   150
  80.       TabIndex        =   1
  81.       Top             =   525
  82.       Width           =   2310
  83.    End
  84.    Begin VB.CommandButton cmdAreaGraph 
  85.       Caption         =   "Make area graph"
  86.       Height          =   375
  87.       Left            =   150
  88.       TabIndex        =   0
  89.       Top             =   90
  90.       Width           =   2310
  91.    End
  92. End
  93. Attribute VB_Name = "frmPortalTest"
  94. Attribute VB_GlobalNameSpace = False
  95. Attribute VB_Creatable = False
  96. Attribute VB_PredeclaredId = True
  97. Attribute VB_Exposed = False
  98. Option Explicit
  99. Option Base 1
  100.  
  101. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  102. Private Const SW_NORMAL = 1
  103.  
  104. Private Sub cmdAreaGraph_Click()
  105.  
  106. Call BuildAreaChart
  107.  
  108. End Sub
  109.  
  110. Private Sub cmdColumnGraph_Click()
  111.  
  112. Call BuildColumnChart
  113.  
  114. End Sub
  115.  
  116. Private Sub cmdDensityGraph_Click()
  117.  
  118. Call BuildDensityChart
  119.  
  120. End Sub
  121.  
  122. Private Sub cmdPieGraph_Click()
  123.  
  124. Call BuildPieChart
  125.  
  126. End Sub
  127.  
  128. Private Sub cmdRCComboGraph_Click()
  129.  
  130. Call Me.BuildRCComboGraph
  131.  
  132. End Sub
  133.  
  134. Private Sub cmdRibbonGraph_Click()
  135.  
  136. Call BuildRibbonChart
  137.  
  138. End Sub
  139.  
  140. Private Sub cmdScatterGraph_Click()
  141.  
  142. Call Me.BuildScatterChart
  143.  
  144. End Sub
  145.  
  146. Private Sub cmdSCComboGraph_Click()
  147.  
  148. Call Me.BuildSCComboGraph
  149.  
  150. End Sub
  151.  
  152. Private Sub cmdSurfaceGraph_Click()
  153.  
  154. Call Me.BuildSurfaceChart
  155.  
  156. End Sub
  157.  
  158. Public Sub BuildAreaChart()
  159. Dim objFactory As PortalTemplate.GraphFactory
  160. Dim objAreaGraph As PortalTemplate.AreaGraph
  161. Dim graphRef As PortalTemplate.IPortalGraph
  162. Dim curSeries As AreaSeriesInfo
  163. Dim objView As Object
  164. Dim scaler As Single
  165. Dim i As Integer
  166. Dim j As Integer
  167. Dim tempHeight As Single
  168.  
  169. Set objFactory = PortalTemplateCtl.CreateFactory
  170. Set objAreaGraph = objFactory.CreateAreaGraph
  171.  
  172. objAreaGraph.BackgroundProps.BackgroundColor = &HEDE7E2
  173. objAreaGraph.BackgroundProps.UseBackgroundColorFade = False
  174.  
  175. objAreaGraph.TitleProps.TextHeight = 1.3
  176. objAreaGraph.TitleProps.Text = "Portal Area Graph"
  177. objAreaGraph.TitleProps.TextFont = VRML_SANS
  178. objAreaGraph.TitleProps.TextStyle = VRML_BOLD
  179. objAreaGraph.TitleProps.TextColor = &H400000
  180.  
  181. objAreaGraph.GridProps.Width = 10
  182. objAreaGraph.GridProps.Height = 8
  183. objAreaGraph.GridProps.Depth = 8
  184. objAreaGraph.GridProps.XAxisCellCount = 5
  185. objAreaGraph.GridProps.YAxisCellCount = 5
  186. objAreaGraph.GridProps.ZAxisCellCount = 3
  187. objAreaGraph.GridProps.WallColor = &H804000
  188. objAreaGraph.GridProps.LineColor = &HBFEAE6
  189. objAreaGraph.GridProps.Transparency = 0.5
  190.  
  191. objAreaGraph.LegendProps.IsBillboarded = True
  192. objAreaGraph.LegendProps.KeyStyle = SPHERE_STYLE
  193. objAreaGraph.LegendProps.TextHeight = 0.6
  194. objAreaGraph.LegendProps.UseSeriesToggle = True
  195. objAreaGraph.LegendProps.TextColor = &H0
  196.  
  197. objAreaGraph.XAxisProps.LabelFont = VRML_SANS
  198. objAreaGraph.XAxisProps.LabelHeight = 0.4
  199. objAreaGraph.XAxisProps.LabelColor = &H0
  200. Call objAreaGraph.XAxisProps.Labels.AddValue("Row 1")
  201. Call objAreaGraph.XAxisProps.Labels.AddValue("Row 2")
  202. Call objAreaGraph.XAxisProps.Labels.AddValue("Row 3")
  203. Call objAreaGraph.XAxisProps.Labels.AddValue("Row 4")
  204. Call objAreaGraph.XAxisProps.Labels.AddValue("Row 5")
  205. objAreaGraph.XAxisProps.HeaderFont = VRML_SANS
  206. objAreaGraph.XAxisProps.HeaderColor = &H0
  207. objAreaGraph.XAxisProps.Header = "X axis"
  208.  
  209. objAreaGraph.YAxisProps.LabelFont = VRML_SANS
  210. objAreaGraph.YAxisProps.LabelHeight = 0.4
  211. objAreaGraph.YAxisProps.LabelColor = &H0
  212. objAreaGraph.YAxisProps.Min = 0#
  213. objAreaGraph.YAxisProps.Max = 15#
  214. objAreaGraph.YAxisProps.HeaderFont = VRML_SANS
  215. objAreaGraph.YAxisProps.HeaderColor = &H0
  216. objAreaGraph.YAxisProps.Header = "Y axis"
  217.  
  218. objAreaGraph.ZAxisProps.LabelFont = VRML_SANS
  219. objAreaGraph.ZAxisProps.LabelHeight = 0.4
  220. objAreaGraph.ZAxisProps.LabelColor = &H0
  221. Call objAreaGraph.ZAxisProps.Labels.AddValue("First series")
  222. Call objAreaGraph.ZAxisProps.Labels.AddValue("Second series")
  223. Call objAreaGraph.ZAxisProps.Labels.AddValue("Third series")
  224. objAreaGraph.ZAxisProps.HeaderFont = VRML_SANS
  225. objAreaGraph.ZAxisProps.HeaderColor = &H0
  226. objAreaGraph.ZAxisProps.Header = "Z axis"
  227.  
  228. objAreaGraph.InteractivityProps.UseDrillUp = False
  229. objAreaGraph.InteractivityProps.UseXAxisDrillDown = False
  230. objAreaGraph.InteractivityProps.UseZAxisDrillDown = False
  231.  
  232. scaler = 15# / 8#
  233. ' set the first series' properties
  234. Set curSeries = objAreaGraph.GetSeries(1)
  235. curSeries.Material.DiffuseColorField.Value = &H91D629
  236. curSeries.PopupProps.UsePopups = True
  237. curSeries.PopupProps.Alignment = VRML_TOP
  238. curSeries.PopupProps.TextHeight = 0.5
  239. curSeries.PopupProps.BorderColor = vbBlack
  240. curSeries.PopupProps.TextColor = vbBlack
  241. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  242. tempHeight = objAreaGraph.GridProps.Height * 0.7
  243. For i = 1 To objAreaGraph.GridProps.XAxisCellCount
  244.     tempHeight = tempHeight + (Rnd() * 3#) - 1.5
  245.     If tempHeight < 0.5 Then
  246.         tempHeight = 0.5
  247.     ElseIf tempHeight > (objAreaGraph.GridProps.Height - 0.5) Then
  248.         tempHeight = objAreaGraph.GridProps.Height - 0.5
  249.     End If
  250.     Call curSeries.Height.AddValue(tempHeight)
  251.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  252. Next i
  253. curSeries.LegendText = "The first series"
  254. curSeries.Depth = 0.3
  255.  
  256. ' set the second series' properties
  257. Set curSeries = objAreaGraph.GetSeries(2)
  258. curSeries.Material.DiffuseColorField.Value = &HBDFFFF
  259. 'curSeries.Material.TransparencyField.Value = 0.5
  260. curSeries.PopupProps.UsePopups = True
  261. curSeries.PopupProps.Alignment = VRML_TOP
  262. curSeries.PopupProps.TextHeight = 0.5
  263. curSeries.PopupProps.BorderColor = vbBlack
  264. curSeries.PopupProps.TextColor = vbBlack
  265. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  266. tempHeight = objAreaGraph.GridProps.Height * 0.5
  267. For i = 1 To objAreaGraph.GridProps.XAxisCellCount
  268.     tempHeight = tempHeight + (Rnd() * 3#) - 1.5
  269.     If tempHeight < 0.5 Then
  270.         tempHeight = 0.5
  271.     ElseIf tempHeight > (objAreaGraph.GridProps.Height - 0.5) Then
  272.         tempHeight = objAreaGraph.GridProps.Height - 0.5
  273.     End If
  274.     Call curSeries.Height.AddValue(tempHeight)
  275.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  276. Next i
  277. curSeries.LegendText = "The second series"
  278. curSeries.Depth = 0.3
  279.  
  280. ' set the next series' properties
  281. Set curSeries = objAreaGraph.GetSeries(3)
  282. curSeries.Material.DiffuseColorField.Value = &HCF8B30
  283. 'curSeries.Material.TransparencyField.Value = 0.5
  284. curSeries.PopupProps.UsePopups = True
  285. curSeries.PopupProps.Alignment = VRML_TOP
  286. curSeries.PopupProps.TextHeight = 0.5
  287. curSeries.PopupProps.BorderColor = vbBlack
  288. curSeries.PopupProps.TextColor = vbBlack
  289. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  290. tempHeight = objAreaGraph.GridProps.Height * 0.3
  291. For i = 1 To objAreaGraph.GridProps.XAxisCellCount
  292.     tempHeight = tempHeight + (Rnd() * 3#) - 1.5
  293.     If tempHeight < 0.5 Then
  294.         tempHeight = 0.5
  295.     ElseIf tempHeight > (objAreaGraph.GridProps.Height - 0.5) Then
  296.         tempHeight = objAreaGraph.GridProps.Height - 0.5
  297.     End If
  298.     Call curSeries.Height.AddValue(tempHeight)
  299.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  300. Next i
  301. curSeries.LegendText = "The third series"
  302. curSeries.Depth = 0.3
  303.  
  304. ' now make the viewpoint
  305. Set objView = objAreaGraph.Viewpoints.AddViewpoint
  306. objView.DescriptionField.Value = "Initial viewpoint"
  307. Call objView.PositionField.SetValues(6, 4, 20)
  308. Call objView.OrientationField.SetEulerValues(-0.05, 0.05, 0)
  309.  
  310. ' export to a file
  311. Call objAreaGraph.ExportToFile(App.Path & "\AreaGraphTest.wrl")
  312. Call AlertComplete(App.Path & "\AreaGraphTest.wrl")
  313.  
  314. End Sub
  315.  
  316. Public Sub BuildRibbonChart()
  317. Dim objFactory As PortalTemplate.GraphFactory
  318. Dim objRibbonGraph As PortalTemplate.RibbonGraph
  319. Dim graphRef As PortalTemplate.IPortalGraph
  320. Dim curSeries As RibbonSeriesInfo
  321. Dim objView As Object
  322. Dim scaler As Single
  323. Dim i As Integer
  324. Dim j As Integer
  325. Dim tempHeight As Single
  326.  
  327. Set objFactory = PortalTemplateCtl.CreateFactory
  328. Set objRibbonGraph = objFactory.CreateRibbonGraph
  329.  
  330. objRibbonGraph.BackgroundProps.BackgroundColor = &HEDE7E2
  331. objRibbonGraph.BackgroundProps.UseBackgroundColorFade = False
  332.  
  333. objRibbonGraph.TitleProps.TextHeight = 1.3
  334. objRibbonGraph.TitleProps.Text = "Portal Ribbon Graph"
  335. objRibbonGraph.TitleProps.TextFont = VRML_SANS
  336. objRibbonGraph.TitleProps.TextStyle = VRML_BOLD
  337. objRibbonGraph.TitleProps.TextColor = &H400000
  338.  
  339. objRibbonGraph.GridProps.Width = 10
  340. objRibbonGraph.GridProps.Height = 8
  341. objRibbonGraph.GridProps.Depth = 8
  342. objRibbonGraph.GridProps.XAxisCellCount = 8
  343. objRibbonGraph.GridProps.YAxisCellCount = 5
  344. objRibbonGraph.GridProps.ZAxisCellCount = 3
  345. objRibbonGraph.GridProps.WallColor = &H804000
  346. objRibbonGraph.GridProps.LineColor = &HBFEAE6
  347. objRibbonGraph.GridProps.Transparency = 0.5
  348.  
  349. objRibbonGraph.LegendProps.IsBillboarded = True
  350. objRibbonGraph.LegendProps.KeyStyle = BOX_STYLE
  351. objRibbonGraph.LegendProps.TextHeight = 0.6
  352. objRibbonGraph.LegendProps.UseSeriesToggle = True
  353. objRibbonGraph.LegendProps.TextColor = &H0
  354.  
  355. objRibbonGraph.XAxisProps.LabelFont = VRML_SANS
  356. objRibbonGraph.XAxisProps.LabelHeight = 0.4
  357. objRibbonGraph.XAxisProps.LabelColor = &H0
  358. Call objRibbonGraph.XAxisProps.Labels.AddValue("Row 1")
  359. Call objRibbonGraph.XAxisProps.Labels.AddValue("Row 2")
  360. Call objRibbonGraph.XAxisProps.Labels.AddValue("Row 3")
  361. Call objRibbonGraph.XAxisProps.Labels.AddValue("Row 4")
  362. Call objRibbonGraph.XAxisProps.Labels.AddValue("Row 5")
  363. Call objRibbonGraph.XAxisProps.Labels.AddValue("Row 6")
  364. Call objRibbonGraph.XAxisProps.Labels.AddValue("Row 7")
  365. Call objRibbonGraph.XAxisProps.Labels.AddValue("Row 8")
  366. objRibbonGraph.XAxisProps.HeaderFont = VRML_SANS
  367. objRibbonGraph.XAxisProps.HeaderColor = &H0
  368. objRibbonGraph.XAxisProps.Header = "X axis"
  369.  
  370. objRibbonGraph.YAxisProps.LabelFont = VRML_SANS
  371. objRibbonGraph.YAxisProps.LabelHeight = 0.5
  372. objRibbonGraph.YAxisProps.LabelColor = &H0
  373. objRibbonGraph.YAxisProps.Min = 0#
  374. objRibbonGraph.YAxisProps.Max = 15#
  375. objRibbonGraph.YAxisProps.HeaderFont = VRML_SANS
  376. objRibbonGraph.YAxisProps.HeaderColor = &H0
  377. objRibbonGraph.YAxisProps.Header = "Y axis"
  378.  
  379. objRibbonGraph.ZAxisProps.LabelFont = VRML_SANS
  380. objRibbonGraph.ZAxisProps.LabelHeight = 0.4
  381. objRibbonGraph.ZAxisProps.LabelColor = &H0
  382. Call objRibbonGraph.ZAxisProps.Labels.AddValue("First series")
  383. Call objRibbonGraph.ZAxisProps.Labels.AddValue("Second series")
  384. Call objRibbonGraph.ZAxisProps.Labels.AddValue("Third series")
  385. objRibbonGraph.ZAxisProps.HeaderFont = VRML_SANS
  386. objRibbonGraph.ZAxisProps.HeaderColor = &H0
  387. objRibbonGraph.ZAxisProps.Header = "Z axis"
  388.  
  389. objRibbonGraph.InteractivityProps.UseDrillUp = False
  390. objRibbonGraph.InteractivityProps.UseXAxisDrillDown = False
  391. objRibbonGraph.InteractivityProps.UseZAxisDrillDown = False
  392.  
  393. scaler = 15# / 8#
  394. ' set the first series' properties
  395. Set curSeries = objRibbonGraph.GetSeries(1)
  396. curSeries.Material.DiffuseColorField.Value = &H91D629
  397. curSeries.PopupProps.UsePopups = True
  398. curSeries.PopupProps.Alignment = VRML_RIGHT
  399. curSeries.PopupProps.TextHeight = 0.5
  400. curSeries.PopupProps.BorderColor = vbBlack
  401. curSeries.PopupProps.TextColor = vbBlack
  402. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  403. tempHeight = objRibbonGraph.GridProps.Height * 0.7
  404. For i = 1 To objRibbonGraph.GridProps.XAxisCellCount
  405.     tempHeight = tempHeight + (Rnd() * 3#) - 1.5
  406.     If tempHeight < 0.5 Then
  407.         tempHeight = 0.5
  408.     ElseIf tempHeight > (objRibbonGraph.GridProps.Height - 0.5) Then
  409.         tempHeight = objRibbonGraph.GridProps.Height - 0.5
  410.     End If
  411.     Call curSeries.Height.AddValue(tempHeight)
  412.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  413. Next i
  414. curSeries.LegendText = "The first series"
  415. curSeries.Depth = 0.6
  416. curSeries.Thickness = 0.3
  417. curSeries.Style = ROUNDED_RIBBON
  418. curSeries.BevelRadius = 0.1
  419.  
  420. ' set the next series' properties
  421. Set curSeries = objRibbonGraph.GetSeries(2)
  422. curSeries.Material.DiffuseColorField.Value = &HBDFFFF
  423. curSeries.Material.TransparencyField.Value = 0.5
  424. curSeries.PopupProps.UsePopups = True
  425. curSeries.PopupProps.Alignment = VRML_TOP
  426. curSeries.PopupProps.TextHeight = 0.5
  427. curSeries.PopupProps.BorderColor = vbBlack
  428. curSeries.PopupProps.TextColor = vbBlack
  429. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  430. tempHeight = objRibbonGraph.GridProps.Height * 0.5
  431. For i = 1 To objRibbonGraph.GridProps.XAxisCellCount
  432.     tempHeight = tempHeight + (Rnd() * 3#) - 1.5
  433.     If tempHeight < 0.5 Then
  434.         tempHeight = 0.5
  435.     ElseIf tempHeight > (objRibbonGraph.GridProps.Height - 0.5) Then
  436.         tempHeight = objRibbonGraph.GridProps.Height - 0.5
  437.     End If
  438.     Call curSeries.Height.AddValue(tempHeight)
  439.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  440. Next i
  441. curSeries.LegendText = "The second series"
  442. curSeries.Depth = 0.6
  443. curSeries.Thickness = 0.3
  444. curSeries.Style = ROUNDED_RIBBON
  445. curSeries.BevelRadius = 0.1
  446.  
  447. ' set the next series' properties
  448. Set curSeries = objRibbonGraph.GetSeries(3)
  449. curSeries.Material.DiffuseColorField.Value = &HCF8B30
  450. curSeries.PopupProps.UsePopups = True
  451. curSeries.PopupProps.Alignment = VRML_RIGHT
  452. curSeries.PopupProps.TextHeight = 0.5
  453. curSeries.PopupProps.BorderColor = vbBlack
  454. curSeries.PopupProps.TextColor = vbBlack
  455. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  456. tempHeight = objRibbonGraph.GridProps.Height * 0.3
  457. For i = 1 To objRibbonGraph.GridProps.XAxisCellCount
  458.     tempHeight = tempHeight + (Rnd() * 3#) - 1.5
  459.     If tempHeight < 0.5 Then
  460.         tempHeight = 0.5
  461.     ElseIf tempHeight > (objRibbonGraph.GridProps.Height - 0.5) Then
  462.         tempHeight = objRibbonGraph.GridProps.Height - 0.5
  463.     End If
  464.     Call curSeries.Height.AddValue(tempHeight)
  465.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  466. Next i
  467. curSeries.LegendText = "The third series"
  468. curSeries.Depth = 0.6
  469. curSeries.Thickness = 0.3
  470. curSeries.Style = ROUNDED_RIBBON
  471. curSeries.BevelRadius = 0.1
  472.  
  473. ' now make the viewpoint
  474. Set objView = objRibbonGraph.Viewpoints.AddViewpoint
  475. objView.DescriptionField.Value = "Initial viewpoint"
  476. Call objView.PositionField.SetValues(6, 4, 20)
  477. Call objView.OrientationField.SetEulerValues(-0.05, 0.05, 0)
  478.  
  479. ' export to a file
  480. Call objRibbonGraph.ExportToFile(App.Path & "\RibbonGraphTest.wrl")
  481. Call AlertComplete(App.Path & "\RibbonGraphTest.wrl")
  482.  
  483. End Sub
  484.  
  485. Public Sub BuildColumnChart()
  486. Dim objFactory As PortalTemplate.GraphFactory
  487. Dim objColumnGraph As PortalTemplate.ColumnGraph
  488. Dim graphRef As PortalTemplate.IPortalGraph
  489. Dim curSeries As ColumnSeriesInfo
  490. Dim objView As Object
  491. Dim scaler As Single
  492. Dim i As Integer
  493. Dim j As Integer
  494. Dim tempHeight As Single
  495.  
  496. Set objFactory = PortalTemplateCtl.CreateFactory
  497. Set objColumnGraph = objFactory.CreateColumnGraph
  498.  
  499. objColumnGraph.ColumnsPerCell = 2
  500. objColumnGraph.ColumnSpacingStyle = ADJACENT
  501.  
  502. objColumnGraph.BackgroundProps.BackgroundColor = &HEDE7E2
  503. objColumnGraph.BackgroundProps.UseBackgroundColorFade = False
  504.  
  505. objColumnGraph.TitleProps.TextHeight = 1.3
  506. objColumnGraph.TitleProps.Text = "Portal Column Graph"
  507. objColumnGraph.TitleProps.TextFont = VRML_SANS
  508. objColumnGraph.TitleProps.TextStyle = VRML_BOLD
  509. objColumnGraph.TitleProps.TextColor = &H400000
  510.  
  511. objColumnGraph.GridProps.Width = 10
  512. objColumnGraph.GridProps.Height = 8
  513. objColumnGraph.GridProps.Depth = 6
  514. objColumnGraph.GridProps.XAxisCellCount = 5
  515. objColumnGraph.GridProps.YAxisCellCount = 5
  516. objColumnGraph.GridProps.ZAxisCellCount = 2
  517. objColumnGraph.GridProps.WallColor = &H804000
  518. objColumnGraph.GridProps.LineColor = &HBFEAE6
  519. objColumnGraph.GridProps.Transparency = 0.5
  520.  
  521. objColumnGraph.LegendProps.IsBillboarded = True
  522. objColumnGraph.LegendProps.KeyStyle = SPHERE_STYLE
  523. objColumnGraph.LegendProps.TextHeight = 0.6
  524. objColumnGraph.LegendProps.UseSeriesToggle = False
  525. objColumnGraph.LegendProps.TextColor = &H0
  526.  
  527. objColumnGraph.XAxisProps.LabelFont = VRML_SANS
  528. objColumnGraph.XAxisProps.LabelHeight = 0.4
  529. objColumnGraph.XAxisProps.LabelColor = &H0
  530. Call objColumnGraph.XAxisProps.Labels.AddValue("Row 1")
  531. Call objColumnGraph.XAxisProps.Labels.AddValue("Row 2")
  532. Call objColumnGraph.XAxisProps.Labels.AddValue("Row 3")
  533. Call objColumnGraph.XAxisProps.Labels.AddValue("Row 4")
  534. Call objColumnGraph.XAxisProps.Labels.AddValue("Row 5")
  535. objColumnGraph.XAxisProps.Header = "X Axis"
  536. objColumnGraph.XAxisProps.HeaderColor = &H0
  537. objColumnGraph.XAxisProps.HeaderFont = VRML_SANS
  538. objColumnGraph.XAxisProps.HeaderHeight = 0.7
  539. objColumnGraph.XAxisProps.HeaderStyle = VRML_BOLD
  540.  
  541. objColumnGraph.YAxisProps.LabelFont = VRML_SANS
  542. objColumnGraph.YAxisProps.LabelHeight = 0.4
  543. objColumnGraph.YAxisProps.LabelColor = &H0
  544. objColumnGraph.YAxisProps.Min = 0#
  545. objColumnGraph.YAxisProps.Max = 15#
  546. objColumnGraph.YAxisProps.Header = "Y Axis"
  547. objColumnGraph.YAxisProps.HeaderColor = &H0
  548. objColumnGraph.YAxisProps.HeaderFont = VRML_SANS
  549. objColumnGraph.YAxisProps.HeaderHeight = 0.7
  550. objColumnGraph.YAxisProps.HeaderStyle = VRML_BOLD
  551.  
  552. objColumnGraph.ZAxisProps.LabelFont = VRML_SANS
  553. objColumnGraph.ZAxisProps.LabelHeight = 0.4
  554. objColumnGraph.ZAxisProps.LabelColor = &H0
  555. Call objColumnGraph.ZAxisProps.Labels.AddValue("First series")
  556. Call objColumnGraph.ZAxisProps.Labels.AddValue("Second series")
  557. objColumnGraph.ZAxisProps.Header = "Z Axis"
  558. objColumnGraph.ZAxisProps.HeaderColor = &H0
  559. objColumnGraph.ZAxisProps.HeaderFont = VRML_SANS
  560. objColumnGraph.ZAxisProps.HeaderHeight = 0.7
  561. objColumnGraph.ZAxisProps.HeaderStyle = VRML_BOLD
  562.  
  563. objColumnGraph.InteractivityProps.UseDrillUp = False
  564. objColumnGraph.InteractivityProps.UseXAxisDrillDown = False
  565. objColumnGraph.InteractivityProps.UseZAxisDrillDown = False
  566.  
  567. scaler = 15# / 8#
  568. ' set the first series' properties
  569. Set curSeries = objColumnGraph.GetSeries(1, 1)
  570. curSeries.Style = ROUNDED_COLUMN
  571. curSeries.Material.DiffuseColorField.Value = &H91D629
  572. curSeries.PopupProps.UsePopups = True
  573. curSeries.PopupProps.Alignment = VRML_RIGHT
  574. curSeries.PopupProps.TextHeight = 0.5
  575. curSeries.PopupProps.BorderColor = vbBlack
  576. curSeries.PopupProps.TextColor = vbBlack
  577. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  578. tempHeight = objColumnGraph.GridProps.Height * 0.5
  579. For i = 1 To objColumnGraph.GridProps.XAxisCellCount
  580.     tempHeight = tempHeight + (Rnd() * 2#) - 1#
  581.     If tempHeight < 0.5 Then
  582.         tempHeight = 0.5
  583.     ElseIf tempHeight > (objColumnGraph.GridProps.Height - 0.5) Then
  584.         tempHeight = objColumnGraph.GridProps.Height - 0.5
  585.     End If
  586.     Call curSeries.Height.AddValue(tempHeight)
  587.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  588. Next i
  589. curSeries.LegendText = "First series"
  590. curSeries.Depth = 0.7
  591. curSeries.Width = 0.5
  592. curSeries.BevelRadius = 0.15
  593.  
  594. ' set the first series' properties
  595. Set curSeries = objColumnGraph.GetSeries(1, 2)
  596. curSeries.Style = ROUNDED_COLUMN
  597. curSeries.Material.DiffuseColorField.Value = &HCF8B30
  598. curSeries.PopupProps.UsePopups = True
  599. curSeries.PopupProps.Alignment = VRML_TOP
  600. curSeries.PopupProps.TextHeight = 0.5
  601. curSeries.PopupProps.BorderColor = vbBlack
  602. curSeries.PopupProps.TextColor = vbBlack
  603. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  604. tempHeight = objColumnGraph.GridProps.Height * 0.7
  605. For i = 1 To objColumnGraph.GridProps.XAxisCellCount
  606.     tempHeight = tempHeight + (Rnd() * 2#) - 1#
  607.     If tempHeight < 0.5 Then
  608.         tempHeight = 0.5
  609.     ElseIf tempHeight > (objColumnGraph.GridProps.Height - 0.5) Then
  610.         tempHeight = objColumnGraph.GridProps.Height - 0.5
  611.     End If
  612.     Call curSeries.Height.AddValue(tempHeight)
  613.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  614. Next i
  615. curSeries.LegendText = "Second series"
  616. curSeries.Depth = 0.7
  617. curSeries.Width = 0.5
  618. curSeries.BevelRadius = 0.15
  619.  
  620. ' set the next series' properties
  621. Set curSeries = objColumnGraph.GetSeries(2, 1)
  622. curSeries.Style = ROUNDED_COLUMN
  623. curSeries.ShowInLegend = False
  624. curSeries.Material.DiffuseColorField.Value = &H91D629
  625. curSeries.Material.TransparencyField.Value = 0.5
  626. curSeries.PopupProps.UsePopups = True
  627. curSeries.PopupProps.Alignment = VRML_RIGHT
  628. curSeries.PopupProps.TextHeight = 0.5
  629. curSeries.PopupProps.BorderColor = vbBlack
  630. curSeries.PopupProps.TextColor = vbBlack
  631. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  632. tempHeight = objColumnGraph.GridProps.Height * 0.2
  633. For i = 1 To objColumnGraph.GridProps.XAxisCellCount
  634.     tempHeight = tempHeight + (Rnd() * 2#) - 1#
  635.     If tempHeight < 0.5 Then
  636.         tempHeight = 0.5
  637.     ElseIf tempHeight > (objColumnGraph.GridProps.Height - 0.5) Then
  638.         tempHeight = objColumnGraph.GridProps.Height - 0.5
  639.     End If
  640.     Call curSeries.Height.AddValue(tempHeight)
  641.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  642. Next i
  643. curSeries.LegendText = "Third series"
  644. curSeries.Depth = 0.7
  645. curSeries.Width = 0.5
  646. curSeries.BevelRadius = 0.15
  647.  
  648. ' set the next series' properties
  649. Set curSeries = objColumnGraph.GetSeries(2, 2)
  650. curSeries.Style = ROUNDED_COLUMN
  651. curSeries.ShowInLegend = False
  652. curSeries.Material.DiffuseColorField.Value = &HCF8B30
  653. curSeries.Material.TransparencyField.Value = 0.5
  654. curSeries.PopupProps.UsePopups = True
  655. curSeries.PopupProps.Alignment = VRML_RIGHT
  656. curSeries.PopupProps.TextHeight = 0.5
  657. curSeries.PopupProps.BorderColor = vbBlack
  658. curSeries.PopupProps.TextColor = vbBlack
  659. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  660. tempHeight = objColumnGraph.GridProps.Height * 0.3
  661. For i = 1 To objColumnGraph.GridProps.XAxisCellCount
  662.     tempHeight = tempHeight + (Rnd() * 2#) - 1#
  663.     If tempHeight < 0.5 Then
  664.         tempHeight = 0.5
  665.     ElseIf tempHeight > (objColumnGraph.GridProps.Height - 0.5) Then
  666.         tempHeight = objColumnGraph.GridProps.Height - 0.5
  667.     End If
  668.     Call curSeries.Height.AddValue(tempHeight)
  669.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  670. Next i
  671. curSeries.LegendText = "Fourth series"
  672. curSeries.Depth = 0.7
  673. curSeries.Width = 0.5
  674. curSeries.BevelRadius = 0.15
  675.  
  676. ' now make the viewpoint
  677. Set objView = objColumnGraph.Viewpoints.AddViewpoint
  678. objView.DescriptionField.Value = "Initial viewpoint"
  679. Call objView.PositionField.SetValues(6, 4, 20)
  680. Call objView.OrientationField.SetEulerValues(-0.05, 0.05, 0)
  681.  
  682. ' export to a file
  683. Call objColumnGraph.ExportToFile(App.Path & "\ColumnGraphTest.wrl")
  684. Call AlertComplete(App.Path & "\ColumnGraphTest.wrl")
  685.  
  686. End Sub
  687.  
  688. Public Sub BuildPieChart()
  689. Dim objFactory As PortalTemplate.GraphFactory
  690. Dim objPieGraph As PortalTemplate.PieGraph
  691. Dim curSlice As PieSliceInfo
  692. Dim i As Integer
  693. Dim j As Integer
  694. Dim objView As Object
  695.  
  696. Set objFactory = PortalTemplateCtl.CreateFactory
  697. Set objPieGraph = objFactory.CreatePieGraph
  698.  
  699. objPieGraph.BackgroundProps.BackgroundColor = &HA4918C
  700. objPieGraph.BackgroundProps.UseBackgroundColorFade = False
  701.  
  702. objPieGraph.TitleProps.TextHeight = 1.5
  703. objPieGraph.TitleProps.Text = "Portal Pie Graph"
  704. objPieGraph.TitleProps.TextFont = VRML_SANS
  705. objPieGraph.TitleProps.TextStyle = VRML_BOLD
  706. objPieGraph.TitleProps.TextColor = &HFFFFFF
  707.  
  708. objPieGraph.LegendProps.IsBillboarded = True
  709. objPieGraph.LegendProps.KeyStyle = BOX_STYLE
  710. objPieGraph.LegendProps.TextHeight = 0.6
  711. objPieGraph.LegendProps.TextColor = &H0
  712. objPieGraph.LegendProps.UseSeriesToggle = True
  713.  
  714. ' set the number of slices
  715. objPieGraph.SliceCount = 4
  716. objPieGraph.radius = 4
  717. objPieGraph.InnerRadius = 2
  718. objPieGraph.BevelRadius = 0.5
  719. objPieGraph.UseSpinAxis = True
  720. objPieGraph.SliceTextDisplayStyle = SHOW_ALWAYS
  721. objPieGraph.UseDrillUp = False
  722.  
  723. ' set the first slice' properties
  724. Set curSlice = objPieGraph.GetSlice(1)
  725. curSlice.Style = RING_SLICE
  726. curSlice.Material.DiffuseColorField.Value = &H91D629
  727. curSlice.Material.TransparencyField.Value = 0.5
  728. curSlice.Percentage = 0.1
  729. curSlice.LegendText = "First slice"
  730. curSlice.Height = 1.6
  731. curSlice.SliceTextProps.Text = "Slice 1 : 10%"
  732. curSlice.SliceTextProps.TextFont = VRML_SANS
  733. curSlice.SliceTextProps.TextHeight = 0.75
  734. curSlice.SliceTextProps.TextColor = &HFFFFFF
  735. curSlice.UseDrillDown = False
  736.  
  737. ' set the next slice' properties
  738. Set curSlice = objPieGraph.GetSlice(2)
  739. curSlice.Style = RING_SLICE
  740. curSlice.Material.DiffuseColorField.Value = &HCF8B30
  741. curSlice.Percentage = 0.2
  742. curSlice.LegendText = "Second slice"
  743. curSlice.Height = 1.8
  744. curSlice.SliceTextProps.Text = "Slice 2 : 20%"
  745. curSlice.SliceTextProps.TextFont = VRML_SANS
  746. curSlice.SliceTextProps.TextHeight = 0.75
  747. curSlice.SliceTextProps.TextColor = &HFFFFFF
  748. curSlice.UseDrillDown = False
  749.  
  750. ' set the next slice' properties
  751. Set curSlice = objPieGraph.GetSlice(3)
  752. curSlice.Style = RING_SLICE
  753. curSlice.Material.DiffuseColorField.Value = &HA4FFFF
  754. curSlice.Material.TransparencyField.Value = 0.5
  755. curSlice.Percentage = 0.4
  756. curSlice.LegendText = "Third slice"
  757. curSlice.Height = 2.2
  758. curSlice.SliceTextProps.Text = "Slice 3 : 40%"
  759. curSlice.SliceTextProps.TextFont = VRML_SANS
  760. curSlice.SliceTextProps.TextHeight = 0.75
  761. curSlice.SliceTextProps.TextColor = &HFFFFFF
  762. curSlice.UseDrillDown = False
  763.  
  764. ' set the last slice' properties
  765. Set curSlice = objPieGraph.GetSlice(4)
  766. curSlice.Style = RING_SLICE
  767. curSlice.Material.DiffuseColorField.Value = &HB3
  768. curSlice.Percentage = 0.3
  769. curSlice.LegendText = "Fourth slice"
  770. curSlice.Height = 2#
  771. curSlice.SliceTextProps.Text = "Slice 4 : 30%"
  772. curSlice.SliceTextProps.TextFont = VRML_SANS
  773. curSlice.SliceTextProps.TextHeight = 0.75
  774. curSlice.SliceTextProps.TextColor = &HFFFFFF
  775. curSlice.UseDrillDown = False
  776.  
  777. ' now make the viewpoint
  778. Set objView = objPieGraph.Viewpoints.AddViewpoint
  779. objView.DescriptionField.Value = "Initial viewpoint"
  780. Call objView.PositionField.SetValues(6, 4, 20)
  781. Call objView.OrientationField.SetEulerValues(-0.05, 0.05, 0)
  782.  
  783. ' export to a file
  784. Call objPieGraph.ExportToFile(App.Path & "\PieGraphTest.wrl")
  785. Call AlertComplete(App.Path & "\PieGraphTest.wrl")
  786.  
  787. End Sub
  788.  
  789. Public Sub BuildScatterChart()
  790. Dim objFactory As PortalTemplate.GraphFactory
  791. Dim objScatterGraph As PortalTemplate.ScatterGraph
  792. Dim i As Integer
  793. Dim j As Integer
  794. Dim tempX As Single
  795. Dim tempY As Single
  796. Dim tempZ As Single
  797. Dim tempRadius As Single
  798. Dim tempColor As Long
  799. Dim tempTransparency As Single
  800. Dim curPointFrame As PortalTemplate.PointCollection
  801. Dim objView As Object
  802.  
  803. Set objFactory = PortalTemplateCtl.CreateFactory
  804. Set objScatterGraph = objFactory.CreateScatterGraph
  805.  
  806. objScatterGraph.BackgroundProps.BackgroundColor = &HEDE7E2
  807. objScatterGraph.BackgroundProps.UseBackgroundColorFade = False
  808.  
  809. objScatterGraph.TitleProps.TextHeight = 1
  810. objScatterGraph.TitleProps.Text = "Portal Scatter Graph"
  811. objScatterGraph.TitleProps.TextFont = VRML_SANS
  812. objScatterGraph.TitleProps.TextStyle = VRML_BOLD
  813. objScatterGraph.TitleProps.TextColor = &H684D4F
  814.  
  815. objScatterGraph.GridProps.Width = 10
  816. objScatterGraph.GridProps.Height = 8
  817. objScatterGraph.GridProps.Depth = 8
  818. objScatterGraph.GridProps.XAxisCellCount = 10
  819. objScatterGraph.GridProps.YAxisCellCount = 5
  820. objScatterGraph.GridProps.ZAxisCellCount = 3
  821. objScatterGraph.GridProps.WallColor = &H804000
  822. objScatterGraph.GridProps.LineColor = &HA2FF44
  823. objScatterGraph.GridProps.Transparency = 0.5
  824.  
  825. objScatterGraph.XAxisProps.LabelFont = VRML_SANS
  826. objScatterGraph.XAxisProps.LabelHeight = 0.4
  827. objScatterGraph.XAxisProps.LabelColor = &H0
  828. objScatterGraph.XAxisProps.HeaderColor = &H0
  829. objScatterGraph.XAxisProps.Min = -120#
  830. objScatterGraph.XAxisProps.Max = 1945#
  831. objScatterGraph.XAxisProps.Header = "X axis"
  832.  
  833. objScatterGraph.YAxisProps.LabelFont = VRML_SANS
  834. objScatterGraph.YAxisProps.LabelHeight = 0.5
  835. objScatterGraph.YAxisProps.LabelColor = &H0
  836. objScatterGraph.YAxisProps.HeaderColor = &H0
  837. objScatterGraph.YAxisProps.Min = 0#
  838. objScatterGraph.YAxisProps.Max = 15#
  839. objScatterGraph.YAxisProps.Header = "Y axis"
  840.  
  841. objScatterGraph.ZAxisProps.LabelFont = VRML_SANS
  842. objScatterGraph.ZAxisProps.LabelHeight = 0.6
  843. objScatterGraph.ZAxisProps.LabelColor = &H0
  844. objScatterGraph.ZAxisProps.HeaderColor = &H0
  845. objScatterGraph.ZAxisProps.Min = 0#
  846. objScatterGraph.ZAxisProps.Max = 5#
  847. objScatterGraph.ZAxisProps.Header = "Z axis"
  848.  
  849. objScatterGraph.FrameTimeGap = 8#
  850. objScatterGraph.PointFrameCount = 6
  851. objScatterGraph.PointAnimationStyle = VRML_DISCRETE
  852. 'objScatterGraph.AnimationLoopStyle = VRML_BACK_AND_FORTH
  853.  
  854. objScatterGraph.LegendProps.IsBillboarded = False
  855. objScatterGraph.LegendProps.KeyStyle = SPHERE_STYLE
  856. objScatterGraph.LegendProps.TextHeight = 0.6
  857. objScatterGraph.LegendProps.TextColor = &H0
  858. Call objScatterGraph.LegendProps.AddLegendEntry(&H91D629, "Category A")
  859. Call objScatterGraph.LegendProps.AddLegendEntry(&HCF8B30, "Category B")
  860. Call objScatterGraph.LegendProps.AddLegendEntry(&HB3, "Category C")
  861.  
  862. Set curPointFrame = objScatterGraph.Get1PointFrame(1)
  863. curPointFrame.Description = "Frame 1"
  864. For i = 1 To 40
  865.     tempX = (Rnd() * objScatterGraph.GridProps.Width * 0.5) + (objScatterGraph.GridProps.Depth * 0.5)
  866.     tempY = (Rnd() * objScatterGraph.GridProps.Height * 0.8) + (objScatterGraph.GridProps.Depth * 0.2)
  867.     tempZ = (Rnd() * objScatterGraph.GridProps.Depth * 0.7) + (objScatterGraph.GridProps.Depth * 0.3)
  868.     tempRadius = (Rnd() * 0.4) + 0.1
  869.     If i < 7 Then
  870.         tempColor = &H91D629
  871.     ElseIf i > 13 Then
  872.         tempColor = &HCF8B30
  873.     Else
  874.         tempColor = &HB3
  875.     End If
  876.     tempTransparency = Rnd() * 0.4
  877.     Call curPointFrame.AddPoint(tempX, tempY, tempZ, tempRadius, tempColor, tempTransparency)
  878. Next i
  879.  
  880. Set curPointFrame = objScatterGraph.Get1PointFrame(2)
  881. curPointFrame.Description = "Frame 2"
  882. For i = 1 To 40
  883.     tempX = (Rnd() * objScatterGraph.GridProps.Width * 0.8) + (objScatterGraph.GridProps.Depth * 0.2)
  884.     tempY = (Rnd() * objScatterGraph.GridProps.Height * 0.2) + (objScatterGraph.GridProps.Depth * 0.8)
  885.     tempZ = (Rnd() * objScatterGraph.GridProps.Depth * 0.3) + (objScatterGraph.GridProps.Depth * 0.7)
  886.     tempRadius = (Rnd() * 0.4) + 0.1
  887.     If i < 7 Then
  888.         tempColor = &H91D629
  889.     ElseIf i > 13 Then
  890.         tempColor = &HCF8B30
  891.     Else
  892.         tempColor = &HB3
  893.     End If
  894.     tempTransparency = Rnd() * 0.4
  895.     Call curPointFrame.AddPoint(tempX, tempY, tempZ, tempRadius, tempColor, tempTransparency)
  896. Next i
  897.  
  898. Set curPointFrame = objScatterGraph.Get1PointFrame(3)
  899. curPointFrame.Description = "Frame 3"
  900. For i = 1 To 40
  901.     tempX = (Rnd() * objScatterGraph.GridProps.Width * 0.3)
  902.     tempY = (Rnd() * objScatterGraph.GridProps.Height * 0.4) + (objScatterGraph.GridProps.Depth * 0.3)
  903.     tempZ = (Rnd() * objScatterGraph.GridProps.Depth * 0.5) + (objScatterGraph.GridProps.Depth * 0.3)
  904.     tempRadius = (Rnd() * 0.4) + 0.1
  905.     If i < 7 Then
  906.         tempColor = &H91D629
  907.     ElseIf i > 13 Then
  908.         tempColor = &HCF8B30
  909.     Else
  910.         tempColor = &HB3
  911.     End If
  912.     tempTransparency = Rnd() * 0.4
  913.     Call curPointFrame.AddPoint(tempX, tempY, tempZ, tempRadius, tempColor, tempTransparency)
  914. Next i
  915.  
  916. Set curPointFrame = objScatterGraph.Get1PointFrame(4)
  917. curPointFrame.Description = "Frame 4"
  918. For i = 1 To 40
  919.     tempX = (Rnd() * objScatterGraph.GridProps.Width * 0.6) + (objScatterGraph.GridProps.Depth * 0.4)
  920.     tempY = (Rnd() * objScatterGraph.GridProps.Height * 0.7) + (objScatterGraph.GridProps.Depth * 0.3)
  921.     tempZ = (Rnd() * objScatterGraph.GridProps.Depth * 0.5) + (objScatterGraph.GridProps.Depth * 0.5)
  922.     tempRadius = (Rnd() * 0.4) + 0.1
  923.     If i < 7 Then
  924.         tempColor = &H91D629
  925.     ElseIf i > 13 Then
  926.         tempColor = &HCF8B30
  927.     Else
  928.         tempColor = &HB3
  929.     End If
  930.     tempTransparency = Rnd() * 0.4
  931.     Call curPointFrame.AddPoint(tempX, tempY, tempZ, tempRadius, tempColor, tempTransparency)
  932. Next i
  933.  
  934. Set curPointFrame = objScatterGraph.Get1PointFrame(5)
  935. curPointFrame.Description = "Frame 5"
  936. For i = 1 To 40
  937.     tempX = (Rnd() * objScatterGraph.GridProps.Width * 0.8) + (objScatterGraph.GridProps.Depth * 0.2)
  938.     tempY = (Rnd() * objScatterGraph.GridProps.Height * 0.2) + (objScatterGraph.GridProps.Depth * 0.8)
  939.     tempZ = (Rnd() * objScatterGraph.GridProps.Depth * 0.3) + (objScatterGraph.GridProps.Depth * 0.7)
  940.     tempRadius = (Rnd() * 0.4) + 0.1
  941.     If i < 7 Then
  942.         tempColor = &H91D629
  943.     ElseIf i > 13 Then
  944.         tempColor = &HCF8B30
  945.     Else
  946.         tempColor = &HB3
  947.     End If
  948.     tempTransparency = Rnd() * 0.4
  949.     Call curPointFrame.AddPoint(tempX, tempY, tempZ, tempRadius, tempColor, tempTransparency)
  950. Next i
  951.  
  952. Set curPointFrame = objScatterGraph.Get1PointFrame(6)
  953. curPointFrame.Description = "Frame 6"
  954. For i = 1 To 40
  955.     tempX = (Rnd() * objScatterGraph.GridProps.Width * 0.5) + (objScatterGraph.GridProps.Depth * 0.5)
  956.     tempY = (Rnd() * objScatterGraph.GridProps.Height * 0.8) + (objScatterGraph.GridProps.Depth * 0.2)
  957.     tempZ = (Rnd() * objScatterGraph.GridProps.Depth * 0.7) + (objScatterGraph.GridProps.Depth * 0.3)
  958.     tempRadius = (Rnd() * 0.4) + 0.1
  959.     If i < 7 Then
  960.         tempColor = &H91D629
  961.     ElseIf i > 13 Then
  962.         tempColor = &HCF8B30
  963.     Else
  964.         tempColor = &HB3
  965.     End If
  966.     tempTransparency = Rnd() * 0.4
  967.     Call curPointFrame.AddPoint(tempX, tempY, tempZ, tempRadius, tempColor, tempTransparency)
  968. Next i
  969.  
  970. ' now make the viewpoint
  971. Set objView = objScatterGraph.Viewpoints.AddViewpoint
  972. objView.DescriptionField.Value = "Initial view point"
  973. Call objView.PositionField.SetValues(6, 4, 20)
  974. Call objView.OrientationField.SetEulerValues(-0.05, 0.05, 0)
  975.  
  976. ' export to a file
  977. Call objScatterGraph.ExportToFile(App.Path & "\ScatterGraphTest.wrl")
  978. Call AlertComplete(App.Path & "\ScatterGraphTest.wrl")
  979.  
  980. End Sub
  981.  
  982. Public Sub BuildSurfaceChart()
  983. Dim objFactory As PortalTemplate.GraphFactory
  984. Dim objSurfaceGraph As PortalTemplate.SurfaceGraph
  985. Dim graphRef As PortalTemplate.IPortalGraph
  986. Dim curSurface As SurfaceInfo
  987. Dim objView As Object
  988. Dim scaler As Single
  989. Dim i As Integer
  990. Dim j As Integer
  991. Dim tempHeight As Single
  992. Dim tempText As String
  993.  
  994. Set objFactory = PortalTemplateCtl.CreateFactory
  995. Set objSurfaceGraph = objFactory.CreateSurfaceGraph
  996.  
  997. objSurfaceGraph.BackgroundProps.BackgroundColor = &HEDE7E2
  998. objSurfaceGraph.BackgroundProps.UseBackgroundColorFade = False
  999.  
  1000. objSurfaceGraph.TitleProps.TextHeight = 1.3
  1001. objSurfaceGraph.TitleProps.Text = "Portal Surface Graph"
  1002. objSurfaceGraph.TitleProps.TextFont = VRML_SANS
  1003. objSurfaceGraph.TitleProps.TextStyle = VRML_BOLD
  1004. objSurfaceGraph.TitleProps.TextColor = &H400000
  1005.  
  1006. objSurfaceGraph.GridProps.Width = 10
  1007. objSurfaceGraph.GridProps.Height = 8
  1008. objSurfaceGraph.GridProps.Depth = 8
  1009. objSurfaceGraph.GridProps.XAxisCellCount = 10
  1010. objSurfaceGraph.GridProps.YAxisCellCount = 5
  1011. objSurfaceGraph.GridProps.ZAxisCellCount = 5
  1012. objSurfaceGraph.GridProps.WallColor = &H804000
  1013. objSurfaceGraph.GridProps.LineColor = &HBFEAE6
  1014. objSurfaceGraph.GridProps.Transparency = 0.5
  1015.  
  1016. objSurfaceGraph.LegendProps.IsBillboarded = True
  1017. objSurfaceGraph.LegendProps.KeyStyle = SPHERE_STYLE
  1018. objSurfaceGraph.LegendProps.TextHeight = 0.6
  1019. objSurfaceGraph.LegendProps.UseSeriesToggle = True
  1020. objSurfaceGraph.LegendProps.TextColor = &H0
  1021.  
  1022. objSurfaceGraph.XAxisProps.LabelFont = VRML_SANS
  1023. objSurfaceGraph.XAxisProps.LabelHeight = 0.4
  1024. objSurfaceGraph.XAxisProps.LabelColor = &H0
  1025. Call objSurfaceGraph.XAxisProps.Labels.AddValue("Row 1")
  1026. Call objSurfaceGraph.XAxisProps.Labels.AddValue("Row 2")
  1027. Call objSurfaceGraph.XAxisProps.Labels.AddValue("Row 3")
  1028. Call objSurfaceGraph.XAxisProps.Labels.AddValue("Row 4")
  1029. Call objSurfaceGraph.XAxisProps.Labels.AddValue("Row 5")
  1030. Call objSurfaceGraph.XAxisProps.Labels.AddValue("Row 6")
  1031. Call objSurfaceGraph.XAxisProps.Labels.AddValue("Row 7")
  1032. Call objSurfaceGraph.XAxisProps.Labels.AddValue("Row 8")
  1033. Call objSurfaceGraph.XAxisProps.Labels.AddValue("Row 9")
  1034. Call objSurfaceGraph.XAxisProps.Labels.AddValue("Row 10")
  1035.  
  1036. objSurfaceGraph.YAxisProps.LabelFont = VRML_SANS
  1037. objSurfaceGraph.YAxisProps.LabelHeight = 0.5
  1038. objSurfaceGraph.YAxisProps.LabelColor = &H0
  1039. objSurfaceGraph.YAxisProps.Min = 0#
  1040. objSurfaceGraph.YAxisProps.Max = 15#
  1041.  
  1042. objSurfaceGraph.ZAxisProps.LabelFont = VRML_SANS
  1043. objSurfaceGraph.ZAxisProps.LabelHeight = 0.4
  1044. objSurfaceGraph.ZAxisProps.LabelColor = &H0
  1045. Call objSurfaceGraph.ZAxisProps.Labels.AddValue("Column 1")
  1046. Call objSurfaceGraph.ZAxisProps.Labels.AddValue("Column 2")
  1047. Call objSurfaceGraph.ZAxisProps.Labels.AddValue("Column 3")
  1048. Call objSurfaceGraph.ZAxisProps.Labels.AddValue("Column 4")
  1049. Call objSurfaceGraph.ZAxisProps.Labels.AddValue("Column 5")
  1050.  
  1051. objSurfaceGraph.InteractivityProps.UseDrillUp = False
  1052.  
  1053. objSurfaceGraph.InteractivityProps.UseXAxisDrillDown = False
  1054. objSurfaceGraph.InteractivityProps.UseZAxisDrillDown = False
  1055.  
  1056. objSurfaceGraph.SurfaceCount = 2
  1057.  
  1058. scaler = 15# / 8#
  1059. ' set the first surface's properties
  1060. Set curSurface = objSurfaceGraph.GetSurface(1)
  1061. curSurface.Material.DiffuseColorField.Value = &H6BA347
  1062. curSurface.LegendText = "Primary surface"
  1063. curSurface.WireColor = &H0
  1064. curSurface.PopupProps.UsePopups = True
  1065. curSurface.PopupProps.TextHeight = 0.5
  1066. curSurface.PopupProps.BorderColor = vbBlack
  1067. curSurface.PopupProps.TextColor = vbBlack
  1068. curSurface.PopupProps.BackgroundColor = &HAEDFD7
  1069. tempHeight = objSurfaceGraph.GridProps.Height / 2#
  1070. For j = 1 To objSurfaceGraph.GridProps.ZAxisCellCount
  1071.     For i = 1 To objSurfaceGraph.GridProps.XAxisCellCount
  1072.         tempHeight = tempHeight + (Rnd() * 1.2) - 0.6
  1073.         tempText = Format((tempHeight * scaler), "#0.00")
  1074.         Call curSurface.Set1HeightPoint(i, j, tempHeight, tempText)
  1075.     Next i
  1076. Next j
  1077.  
  1078. ' set the secondary surface's properties
  1079. Set curSurface = objSurfaceGraph.GetSurface(2)
  1080. curSurface.Material.DiffuseColorField.Value = &H660B97
  1081. curSurface.Material.TransparencyField.Value = 0.5
  1082. curSurface.LegendText = "Secondary surface"
  1083. curSurface.WireColor = &HCCECC4
  1084. curSurface.PopupProps.UsePopups = True
  1085. curSurface.PopupProps.TextHeight = 0.5
  1086. curSurface.PopupProps.BorderColor = vbBlack
  1087. curSurface.PopupProps.TextColor = vbBlack
  1088. curSurface.PopupProps.BackgroundColor = &HAEDFD7
  1089. tempHeight = objSurfaceGraph.GridProps.Height / 2#
  1090. For j = 1 To objSurfaceGraph.GridProps.ZAxisCellCount
  1091.     For i = 1 To objSurfaceGraph.GridProps.XAxisCellCount
  1092.         tempHeight = tempHeight + (Rnd() * 1.2) - 0.6
  1093.         tempText = Format((tempHeight * scaler), "#0.00")
  1094.         Call curSurface.Set1HeightPoint(i, j, tempHeight, tempText)
  1095.     Next i
  1096. Next j
  1097.  
  1098. ' now make the viewpoint
  1099. Set objView = objSurfaceGraph.Viewpoints.AddViewpoint
  1100. objView.DescriptionField.Value = "Initial view point"
  1101. Call objView.PositionField.SetValues(6, 4, 20)
  1102. Call objView.OrientationField.SetEulerValues(-0.05, 0.05, 0)
  1103.  
  1104. ' export to a file
  1105. Call objSurfaceGraph.ExportToFile(App.Path & "\SurfaceGraphTest.wrl")
  1106. Call AlertComplete(App.Path & "\SurfaceGraphTest.wrl")
  1107.  
  1108. End Sub
  1109.  
  1110. Public Sub BuildDensityChart()
  1111. Dim objFactory As PortalTemplate.GraphFactory
  1112. Dim objDensityGraph As PortalTemplate.DensityGraph
  1113. Dim curSurface As PortalTemplate.DensitySurfaceInfo
  1114. Dim i As Integer
  1115. Dim j As Integer
  1116. Dim tempX As Single
  1117. Dim tempZ As Single
  1118. Dim graphRef As IPortalGraph
  1119. Dim tempHeight As Single
  1120. Dim tempText As String
  1121. Dim objView As Object
  1122.  
  1123. Set objFactory = PortalTemplateCtl.CreateFactory
  1124. Set objDensityGraph = objFactory.CreateDensityGraph
  1125.  
  1126. objDensityGraph.BackgroundProps.BackgroundColor = &HEDE7E2
  1127. objDensityGraph.BackgroundProps.UseBackgroundColorFade = False
  1128.  
  1129. objDensityGraph.TitleProps.TextHeight = 1
  1130. objDensityGraph.TitleProps.Text = "Portal Density Graph"
  1131. objDensityGraph.TitleProps.TextFont = VRML_SANS
  1132. objDensityGraph.TitleProps.TextStyle = VRML_BOLD
  1133. objDensityGraph.TitleProps.TextColor = &H684D4F
  1134.  
  1135. objDensityGraph.GridProps.Width = 10
  1136. objDensityGraph.GridProps.Height = 8
  1137. objDensityGraph.GridProps.Depth = 8
  1138. objDensityGraph.GridProps.XAxisCellCount = 10
  1139. objDensityGraph.GridProps.YAxisCellCount = 5
  1140. objDensityGraph.GridProps.ZAxisCellCount = 6
  1141. objDensityGraph.GridProps.WallColor = &H804000
  1142. objDensityGraph.GridProps.LineColor = &HA2FF44
  1143. objDensityGraph.GridProps.Transparency = 0.5
  1144.  
  1145. objDensityGraph.XAxisProps.LabelFont = VRML_SANS
  1146. objDensityGraph.XAxisProps.LabelHeight = 0.4
  1147. objDensityGraph.XAxisProps.LabelColor = &H0
  1148. objDensityGraph.XAxisProps.Min = 0#
  1149. objDensityGraph.XAxisProps.Max = 20#
  1150.  
  1151. objDensityGraph.YAxisProps.LabelFont = VRML_SANS
  1152. objDensityGraph.YAxisProps.LabelHeight = 0.5
  1153. objDensityGraph.YAxisProps.LabelColor = &H0
  1154. objDensityGraph.YAxisProps.Min = 0#
  1155. objDensityGraph.YAxisProps.Max = 15#
  1156.  
  1157. objDensityGraph.ZAxisProps.LabelFont = VRML_SANS
  1158. objDensityGraph.ZAxisProps.LabelHeight = 0.6
  1159. objDensityGraph.ZAxisProps.LabelColor = &H0
  1160. objDensityGraph.ZAxisProps.Min = 0#
  1161. objDensityGraph.ZAxisProps.Max = 10#
  1162.  
  1163. objDensityGraph.SurfaceCount = 2
  1164. objDensityGraph.Sigma = 0.8
  1165.  
  1166. objDensityGraph.LegendProps.IsBillboarded = False
  1167. objDensityGraph.LegendProps.UseSeriesToggle = True
  1168. objDensityGraph.LegendProps.KeyStyle = SPHERE_STYLE
  1169. objDensityGraph.LegendProps.TextHeight = 0.6
  1170. objDensityGraph.LegendProps.TextColor = &H0
  1171.  
  1172. Set curSurface = objDensityGraph.GetSurface(1)
  1173. curSurface.Material.DiffuseColorField.Value = &H6BA347
  1174. curSurface.LegendText = "Primary surface"
  1175. curSurface.WireColor = &H0
  1176. For i = 1 To 10
  1177.     tempX = Rnd() * objDensityGraph.GridProps.Width * 0.5
  1178.     tempZ = Rnd() * objDensityGraph.GridProps.Depth * 0.5
  1179.     Call curSurface.PointList.AddValue(tempX, tempZ)
  1180. Next i
  1181.  
  1182. Set curSurface = objDensityGraph.GetSurface(2)
  1183. curSurface.Material.DiffuseColorField.Value = &H974B00
  1184. curSurface.Material.TransparencyField.Value = 0.5
  1185. curSurface.LegendText = "Secondary surface"
  1186. curSurface.WireColor = &HCCECC4
  1187. For i = 1 To 10
  1188.     tempX = (Rnd() * objDensityGraph.GridProps.Width * 0.5) + (objDensityGraph.GridProps.Width * 0.5)
  1189.     tempZ = (Rnd() * objDensityGraph.GridProps.Depth * 0.5) + (objDensityGraph.GridProps.Depth * 0.5)
  1190.     Call curSurface.PointList.AddValue(tempX, tempZ)
  1191. Next i
  1192.  
  1193. ' now make the viewpoint
  1194. Set objView = objDensityGraph.Viewpoints.AddViewpoint
  1195. objView.DescriptionField.Value = "Initial view point"
  1196. Call objView.PositionField.SetValues(6, 4, 20)
  1197. Call objView.OrientationField.SetEulerValues(-0.05, 0.05, 0)
  1198.  
  1199. ' export to a file
  1200. Call objDensityGraph.ExportToFile(App.Path & "\DensityGraphTest.wrl")
  1201. Call AlertComplete(App.Path & "\DensityGraphTest.wrl")
  1202.  
  1203. End Sub
  1204.  
  1205.  
  1206. Public Sub BuildSCComboGraph()
  1207. Dim objFactory As PortalTemplate.GraphFactory
  1208. Dim objSCComboGraph As PortalTemplate.SCComboGraph
  1209. Dim curSurface As SurfaceInfo
  1210. Dim graphRef As PortalTemplate.IPortalGraph
  1211. Dim curSeries As ColumnSeriesInfo
  1212. Dim objView As Object
  1213. Dim scaler As Single
  1214. Dim i As Integer
  1215. Dim j As Integer
  1216. Dim tempHeight As Single
  1217. Dim tempText As String
  1218.  
  1219. Set objFactory = PortalTemplateCtl.CreateFactory
  1220. Set objSCComboGraph = objFactory.CreateSCComboGraph
  1221.  
  1222. objSCComboGraph.ColumnsPerCell = 1
  1223. 'objSCComboGraph.ColumnSpacingStyle = ADJACENT
  1224.  
  1225. objSCComboGraph.BackgroundProps.BackgroundColor = &HEDE7E2
  1226. objSCComboGraph.BackgroundProps.UseBackgroundColorFade = False
  1227.  
  1228. objSCComboGraph.TitleProps.TextHeight = 1.3
  1229. objSCComboGraph.TitleProps.Text = "Portal Surface/Column Graph"
  1230. objSCComboGraph.TitleProps.TextFont = VRML_SANS
  1231. objSCComboGraph.TitleProps.TextStyle = VRML_BOLD
  1232. objSCComboGraph.TitleProps.TextColor = &H400000
  1233.  
  1234. objSCComboGraph.GridProps.Width = 12
  1235. objSCComboGraph.GridProps.Height = 8
  1236. objSCComboGraph.GridProps.Depth = 10
  1237. objSCComboGraph.GridProps.XAxisCellCount = 5
  1238. objSCComboGraph.GridProps.YAxisCellCount = 5
  1239. objSCComboGraph.GridProps.ZAxisCellCount = 4
  1240. objSCComboGraph.GridProps.WallColor = &H804000
  1241. objSCComboGraph.GridProps.LineColor = &HBFEAE6
  1242. objSCComboGraph.GridProps.Transparency = 0.5
  1243.  
  1244. objSCComboGraph.LegendProps.IsBillboarded = True
  1245. objSCComboGraph.LegendProps.KeyStyle = SPHERE_STYLE
  1246. objSCComboGraph.LegendProps.TextHeight = 0.6
  1247. objSCComboGraph.LegendProps.UseSeriesToggle = False
  1248. objSCComboGraph.LegendProps.TextColor = &H0
  1249.  
  1250. objSCComboGraph.XAxisProps.LabelFont = VRML_SANS
  1251. objSCComboGraph.XAxisProps.LabelHeight = 0.4
  1252. objSCComboGraph.XAxisProps.LabelColor = &H0
  1253. Call objSCComboGraph.XAxisProps.Labels.AddValue("Row 1")
  1254. Call objSCComboGraph.XAxisProps.Labels.AddValue("Row 2")
  1255. Call objSCComboGraph.XAxisProps.Labels.AddValue("Row 3")
  1256. Call objSCComboGraph.XAxisProps.Labels.AddValue("Row 4")
  1257. Call objSCComboGraph.XAxisProps.Labels.AddValue("Row 5")
  1258. objSCComboGraph.XAxisProps.Header = "X Axis"
  1259. objSCComboGraph.XAxisProps.HeaderColor = &H0
  1260. objSCComboGraph.XAxisProps.HeaderFont = VRML_SANS
  1261. objSCComboGraph.XAxisProps.HeaderHeight = 0.7
  1262. objSCComboGraph.XAxisProps.HeaderStyle = VRML_BOLD
  1263.  
  1264. objSCComboGraph.YAxisProps.LabelFont = VRML_SANS
  1265. objSCComboGraph.YAxisProps.LabelHeight = 0.5
  1266. objSCComboGraph.YAxisProps.LabelColor = &H0
  1267. objSCComboGraph.YAxisProps.Min = 0#
  1268. objSCComboGraph.YAxisProps.Max = 15#
  1269. objSCComboGraph.YAxisProps.Header = "Y Axis"
  1270. objSCComboGraph.YAxisProps.HeaderColor = &H0
  1271. objSCComboGraph.YAxisProps.HeaderFont = VRML_SANS
  1272. objSCComboGraph.YAxisProps.HeaderHeight = 0.7
  1273. objSCComboGraph.YAxisProps.HeaderStyle = VRML_BOLD
  1274.  
  1275. objSCComboGraph.ZAxisProps.LabelFont = VRML_SANS
  1276. objSCComboGraph.ZAxisProps.LabelHeight = 0.4
  1277. objSCComboGraph.ZAxisProps.LabelColor = &H0
  1278. Call objSCComboGraph.ZAxisProps.Labels.AddValue("Column 1")
  1279. Call objSCComboGraph.ZAxisProps.Labels.AddValue("Column 2")
  1280. Call objSCComboGraph.ZAxisProps.Labels.AddValue("Column 3")
  1281. Call objSCComboGraph.ZAxisProps.Labels.AddValue("Column 4")
  1282. objSCComboGraph.ZAxisProps.Header = "Z Axis"
  1283. objSCComboGraph.ZAxisProps.HeaderColor = &H0
  1284. objSCComboGraph.ZAxisProps.HeaderFont = VRML_SANS
  1285. objSCComboGraph.ZAxisProps.HeaderHeight = 0.7
  1286. objSCComboGraph.ZAxisProps.HeaderStyle = VRML_BOLD
  1287.  
  1288. objSCComboGraph.InteractivityProps.UseDrillUp = False
  1289. objSCComboGraph.InteractivityProps.UseXAxisDrillDown = False
  1290. objSCComboGraph.InteractivityProps.UseZAxisDrillDown = False
  1291.  
  1292. scaler = 15# / 8#
  1293. ' set the first series' properties
  1294. Set curSeries = objSCComboGraph.GetSeries(1)
  1295. curSeries.Width = 0.5
  1296. curSeries.Depth = 0.6
  1297. curSeries.BevelRadius = 0.2
  1298. curSeries.Style = ROUNDED_COLUMN
  1299. curSeries.Material.DiffuseColorField.Value = &H91D629
  1300. curSeries.PopupProps.UsePopups = True
  1301. curSeries.PopupProps.Alignment = VRML_RIGHT
  1302. curSeries.PopupProps.TextHeight = 0.5
  1303. curSeries.PopupProps.BorderColor = vbBlack
  1304. curSeries.PopupProps.TextColor = vbBlack
  1305. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  1306. tempHeight = objSCComboGraph.GridProps.Height * 0.7
  1307. For i = 1 To objSCComboGraph.GridProps.XAxisCellCount
  1308.     tempHeight = tempHeight + (Rnd() * 2#) - 1#
  1309.     If tempHeight < 0.5 Then
  1310.         tempHeight = 0.5
  1311.     ElseIf tempHeight > (objSCComboGraph.GridProps.Height - 0.5) Then
  1312.         tempHeight = objSCComboGraph.GridProps.Height - 0.5
  1313.     End If
  1314.     Call curSeries.Height.AddValue(tempHeight)
  1315.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  1316. Next i
  1317. curSeries.LegendText = "First series"
  1318. curSeries.ShowInLegend = True
  1319.  
  1320. ' set the first series' properties
  1321. Set curSeries = objSCComboGraph.GetSeries(2)
  1322. curSeries.Width = 0.5
  1323. curSeries.Depth = 0.6
  1324. curSeries.BevelRadius = 0.2
  1325. curSeries.Style = ROUNDED_COLUMN
  1326. curSeries.Material.DiffuseColorField.Value = &HCF8B30
  1327. curSeries.PopupProps.UsePopups = True
  1328. curSeries.PopupProps.Alignment = VRML_TOP
  1329. curSeries.PopupProps.TextHeight = 0.5
  1330. curSeries.PopupProps.BorderColor = vbBlack
  1331. curSeries.PopupProps.TextColor = vbBlack
  1332. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  1333. tempHeight = objSCComboGraph.GridProps.Height * 0.6
  1334. For i = 1 To objSCComboGraph.GridProps.XAxisCellCount
  1335.     tempHeight = tempHeight + (Rnd() * 2#) - 1#
  1336.     If tempHeight < 0.5 Then
  1337.         tempHeight = 0.5
  1338.     ElseIf tempHeight > (objSCComboGraph.GridProps.Height - 0.5) Then
  1339.         tempHeight = objSCComboGraph.GridProps.Height - 0.5
  1340.     End If
  1341.     Call curSeries.Height.AddValue(tempHeight)
  1342.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  1343. Next i
  1344. curSeries.LegendText = "Second series"
  1345. curSeries.ShowInLegend = True
  1346.  
  1347. ' set the next series' properties
  1348. Set curSeries = objSCComboGraph.GetSeries(3)
  1349. curSeries.Width = 0.5
  1350. curSeries.Depth = 0.6
  1351. curSeries.BevelRadius = 0.2
  1352. curSeries.Style = ROUNDED_COLUMN
  1353. curSeries.Material.DiffuseColorField.Value = &H97FFFF
  1354. 'curSeries.Material.TransparencyField.Value = 0.4
  1355. curSeries.PopupProps.UsePopups = True
  1356. curSeries.PopupProps.Alignment = VRML_RIGHT
  1357. curSeries.PopupProps.TextHeight = 0.5
  1358. curSeries.PopupProps.BorderColor = vbBlack
  1359. curSeries.PopupProps.TextColor = vbBlack
  1360. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  1361. tempHeight = objSCComboGraph.GridProps.Height * 0.3
  1362. For i = 1 To objSCComboGraph.GridProps.XAxisCellCount
  1363.     tempHeight = tempHeight + (Rnd() * 2#) - 1#
  1364.     If tempHeight < 0.5 Then
  1365.         tempHeight = 0.5
  1366.     ElseIf tempHeight > (objSCComboGraph.GridProps.Height - 0.5) Then
  1367.         tempHeight = objSCComboGraph.GridProps.Height - 0.5
  1368.     End If
  1369.     Call curSeries.Height.AddValue(tempHeight)
  1370.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  1371. Next i
  1372. curSeries.LegendText = "Third series"
  1373. curSeries.ShowInLegend = True
  1374.  
  1375. ' set the next series' properties
  1376. Set curSeries = objSCComboGraph.GetSeries(4)
  1377. curSeries.Width = 0.5
  1378. curSeries.Depth = 0.6
  1379. curSeries.BevelRadius = 0.2
  1380. curSeries.Style = ROUNDED_COLUMN
  1381. curSeries.Material.DiffuseColorField.Value = &HB3
  1382. 'curSeries.Material.TransparencyField.Value = 0.1
  1383. curSeries.PopupProps.UsePopups = True
  1384. curSeries.PopupProps.Alignment = VRML_RIGHT
  1385. curSeries.PopupProps.TextHeight = 0.5
  1386. curSeries.PopupProps.BorderColor = vbBlack
  1387. curSeries.PopupProps.TextColor = vbBlack
  1388. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  1389. tempHeight = objSCComboGraph.GridProps.Height * 0.2
  1390. For i = 1 To objSCComboGraph.GridProps.XAxisCellCount
  1391.     tempHeight = tempHeight + (Rnd() * 2#) - 1#
  1392.     If tempHeight < 0.5 Then
  1393.         tempHeight = 0.5
  1394.     ElseIf tempHeight > (objSCComboGraph.GridProps.Height - 0.5) Then
  1395.         tempHeight = objSCComboGraph.GridProps.Height - 0.5
  1396.     End If
  1397.     Call curSeries.Height.AddValue(tempHeight)
  1398.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  1399. Next i
  1400. curSeries.LegendText = "Fourth series"
  1401. curSeries.ShowInLegend = True
  1402.  
  1403. objSCComboGraph.SurfaceCount = 1
  1404.  
  1405. scaler = 15# / 8#
  1406. ' set the first surface's properties
  1407. Set curSurface = objSCComboGraph.GetSurface(1)
  1408. curSurface.Material.DiffuseColorField.Value = &HFFFFFA
  1409. curSurface.Material.TransparencyField.Value = 0.5
  1410. curSurface.LegendText = "Primary surface"
  1411. curSurface.WireColor = &H0
  1412. curSurface.PopupProps.UsePopups = True
  1413. curSurface.PopupProps.TextHeight = 0.5
  1414. curSurface.PopupProps.BorderColor = vbBlack
  1415. curSurface.PopupProps.TextColor = vbBlack
  1416. curSurface.PopupProps.BackgroundColor = &HAEDFD7
  1417. For j = 1 To objSCComboGraph.GridProps.ZAxisCellCount
  1418.     If j = 1 Then
  1419.         tempHeight = objSCComboGraph.GridProps.Height * 0.6
  1420.     ElseIf j = 2 Then
  1421.         tempHeight = objSCComboGraph.GridProps.Height * 0.5
  1422.     ElseIf j = 3 Then
  1423.         tempHeight = objSCComboGraph.GridProps.Height * 0.2
  1424.     ElseIf j = 4 Then
  1425.         tempHeight = objSCComboGraph.GridProps.Height * 0.1
  1426.     End If
  1427.     For i = 1 To objSCComboGraph.GridProps.XAxisCellCount
  1428.         tempHeight = tempHeight + (Rnd() * 1#) - 0.5
  1429.         If tempHeight < 0.2 Then
  1430.             tempHeight = 0.2
  1431.         ElseIf tempHeight > (objSCComboGraph.GridProps.Height - 0.5) Then
  1432.             tempHeight = objSCComboGraph.GridProps.Height - 0.5
  1433.         End If
  1434.         tempText = Format((tempHeight * scaler), "#0.00")
  1435.         Call curSurface.Set1HeightPoint(i, j, tempHeight, tempText)
  1436.     Next i
  1437. Next j
  1438.  
  1439. ' now make the viewpoint
  1440. Set objView = objSCComboGraph.Viewpoints.AddViewpoint
  1441. objView.DescriptionField.Value = "Initial view point"
  1442. Call objView.PositionField.SetValues(6, 4, 20)
  1443. Call objView.OrientationField.SetEulerValues(-0.05, 0.05, 0)
  1444.  
  1445. ' export to a file
  1446. Call objSCComboGraph.ExportToFile(App.Path & "\SCComboGraphTest.wrl")
  1447. Call AlertComplete(App.Path & "\SCComboGraphTest.wrl")
  1448.  
  1449. End Sub
  1450.  
  1451. Public Sub BuildRCComboGraph()
  1452. Dim objFactory As PortalTemplate.GraphFactory
  1453. Dim objRCComboGraph As PortalTemplate.RCComboGraph
  1454. Dim graphRef As PortalTemplate.IPortalGraph
  1455. Dim curSeries As RibbonSeriesInfo
  1456. Dim curSurface As SurfaceInfo
  1457. Dim objView As Object
  1458. Dim scaler As Single
  1459. Dim i As Integer
  1460. Dim j As Integer
  1461. Dim tempHeight As Single
  1462. Dim tempText As String
  1463.  
  1464. Set objFactory = PortalTemplateCtl.CreateFactory
  1465. Set objRCComboGraph = objFactory.CreateRCComboGraph
  1466.  
  1467. objRCComboGraph.BackgroundProps.BackgroundColor = &HEDE7E2
  1468. objRCComboGraph.BackgroundProps.UseBackgroundColorFade = False
  1469.  
  1470. objRCComboGraph.TitleProps.TextHeight = 1.3
  1471. objRCComboGraph.TitleProps.Text = "Portal Surface/Column Graph"
  1472. objRCComboGraph.TitleProps.TextFont = VRML_SANS
  1473. objRCComboGraph.TitleProps.TextStyle = VRML_BOLD
  1474. objRCComboGraph.TitleProps.TextColor = &H400000
  1475.  
  1476. objRCComboGraph.GridProps.Width = 10
  1477. objRCComboGraph.GridProps.Height = 8
  1478. objRCComboGraph.GridProps.Depth = 8
  1479. objRCComboGraph.GridProps.XAxisCellCount = 10
  1480. objRCComboGraph.GridProps.YAxisCellCount = 5
  1481. objRCComboGraph.GridProps.ZAxisCellCount = 4
  1482. objRCComboGraph.GridProps.WallColor = &H804000
  1483. objRCComboGraph.GridProps.LineColor = &HBFEAE6
  1484. objRCComboGraph.GridProps.Transparency = 0.5
  1485.  
  1486. objRCComboGraph.LegendProps.IsBillboarded = True
  1487. objRCComboGraph.LegendProps.KeyStyle = SPHERE_STYLE
  1488. objRCComboGraph.LegendProps.TextHeight = 0.6
  1489. objRCComboGraph.LegendProps.UseSeriesToggle = True
  1490. objRCComboGraph.LegendProps.TextColor = &H0
  1491.  
  1492. objRCComboGraph.XAxisProps.LabelFont = VRML_SANS
  1493. objRCComboGraph.XAxisProps.LabelHeight = 0.4
  1494. objRCComboGraph.XAxisProps.LabelColor = &H0
  1495. Call objRCComboGraph.XAxisProps.Labels.AddValue("Row 1")
  1496. Call objRCComboGraph.XAxisProps.Labels.AddValue("Row 2")
  1497. Call objRCComboGraph.XAxisProps.Labels.AddValue("Row 3")
  1498. Call objRCComboGraph.XAxisProps.Labels.AddValue("Row 4")
  1499. Call objRCComboGraph.XAxisProps.Labels.AddValue("Row 5")
  1500. Call objRCComboGraph.XAxisProps.Labels.AddValue("Row 6")
  1501. Call objRCComboGraph.XAxisProps.Labels.AddValue("Row 7")
  1502. Call objRCComboGraph.XAxisProps.Labels.AddValue("Row 8")
  1503. Call objRCComboGraph.XAxisProps.Labels.AddValue("Row 9")
  1504. Call objRCComboGraph.XAxisProps.Labels.AddValue("Row 10")
  1505.  
  1506. objRCComboGraph.YAxisProps.LabelFont = VRML_SANS
  1507. objRCComboGraph.YAxisProps.LabelHeight = 0.5
  1508. objRCComboGraph.YAxisProps.LabelColor = &H0
  1509. objRCComboGraph.YAxisProps.Min = 0#
  1510. objRCComboGraph.YAxisProps.Max = 15#
  1511.  
  1512. objRCComboGraph.ZAxisProps.LabelFont = VRML_SANS
  1513. objRCComboGraph.ZAxisProps.LabelHeight = 0.4
  1514. objRCComboGraph.ZAxisProps.LabelColor = &H0
  1515. Call objRCComboGraph.XAxisProps.Labels.AddValue("Column 1")
  1516. Call objRCComboGraph.XAxisProps.Labels.AddValue("Column 2")
  1517. Call objRCComboGraph.XAxisProps.Labels.AddValue("Column 3")
  1518. Call objRCComboGraph.XAxisProps.Labels.AddValue("Column 4")
  1519.  
  1520. scaler = 15# / 8#
  1521. ' set the first series' properties
  1522. Set curSeries = objRCComboGraph.GetSeries(1)
  1523. curSeries.Style = ROUNDED_RIBBON
  1524. curSeries.Material.DiffuseColorField.Value = &H91D629
  1525. curSeries.PopupProps.UsePopups = True
  1526. curSeries.PopupProps.Alignment = VRML_RIGHT
  1527. curSeries.PopupProps.TextHeight = 0.5
  1528. curSeries.PopupProps.BorderColor = vbBlack
  1529. curSeries.PopupProps.TextColor = vbBlack
  1530. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  1531. tempHeight = objRCComboGraph.GridProps.Height * 0.7
  1532. For i = 1 To objRCComboGraph.GridProps.XAxisCellCount
  1533.     tempHeight = tempHeight + (Rnd() * 2#) - 1#
  1534.     If tempHeight < 0.5 Then
  1535.         tempHeight = 0.5
  1536.     ElseIf tempHeight > (objRCComboGraph.GridProps.Height - 0.5) Then
  1537.         tempHeight = objRCComboGraph.GridProps.Height - 0.5
  1538.     End If
  1539.     Call curSeries.Height.AddValue(tempHeight)
  1540.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  1541. Next i
  1542. curSeries.LegendText = "First series"
  1543. curSeries.Depth = 0.6
  1544. curSeries.Thickness = 0.3
  1545. curSeries.Style = ROUNDED_RIBBON
  1546. curSeries.BevelRadius = 0.1
  1547.  
  1548. ' set the first series' properties
  1549. Set curSeries = objRCComboGraph.GetSeries(2)
  1550. curSeries.Style = ROUNDED_RIBBON
  1551. curSeries.Material.DiffuseColorField.Value = &HBDFFFF
  1552. curSeries.Material.ShininessField.Value = 0.3
  1553. curSeries.PopupProps.UsePopups = True
  1554. curSeries.PopupProps.Alignment = VRML_TOP
  1555. curSeries.PopupProps.TextHeight = 0.5
  1556. curSeries.PopupProps.BorderColor = vbBlack
  1557. curSeries.PopupProps.TextColor = vbBlack
  1558. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  1559. tempHeight = objRCComboGraph.GridProps.Height * 0.6
  1560. For i = 1 To objRCComboGraph.GridProps.XAxisCellCount
  1561.     tempHeight = tempHeight + (Rnd() * 2#) - 1#
  1562.     If tempHeight < 0.5 Then
  1563.         tempHeight = 0.5
  1564.     ElseIf tempHeight > (objRCComboGraph.GridProps.Height - 0.5) Then
  1565.         tempHeight = objRCComboGraph.GridProps.Height - 0.5
  1566.     End If
  1567.     Call curSeries.Height.AddValue(tempHeight)
  1568.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  1569. Next i
  1570. curSeries.LegendText = "Second series"
  1571. curSeries.Depth = 0.6
  1572. curSeries.Thickness = 0.3
  1573. curSeries.Style = ROUNDED_RIBBON
  1574. curSeries.BevelRadius = 0.1
  1575.  
  1576. ' set the next series' properties
  1577. Set curSeries = objRCComboGraph.GetSeries(3)
  1578. curSeries.Style = ROUNDED_RIBBON
  1579. curSeries.Material.DiffuseColorField.Value = &HCF8B30
  1580. curSeries.Material.ShininessField.Value = 0.6
  1581. curSeries.PopupProps.UsePopups = True
  1582. curSeries.PopupProps.Alignment = VRML_RIGHT
  1583. curSeries.PopupProps.TextHeight = 0.5
  1584. curSeries.PopupProps.BorderColor = vbBlack
  1585. curSeries.PopupProps.TextColor = vbBlack
  1586. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  1587. tempHeight = objRCComboGraph.GridProps.Height * 0.3
  1588. For i = 1 To objRCComboGraph.GridProps.XAxisCellCount
  1589.     tempHeight = tempHeight + (Rnd() * 2#) - 1#
  1590.     If tempHeight < 0.5 Then
  1591.         tempHeight = 0.5
  1592.     ElseIf tempHeight > (objRCComboGraph.GridProps.Height - 0.5) Then
  1593.         tempHeight = objRCComboGraph.GridProps.Height - 0.5
  1594.     End If
  1595.     Call curSeries.Height.AddValue(tempHeight)
  1596.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  1597. Next i
  1598. curSeries.LegendText = "Third series"
  1599. curSeries.Depth = 0.6
  1600. curSeries.Thickness = 0.3
  1601. curSeries.Style = ROUNDED_RIBBON
  1602. curSeries.BevelRadius = 0.1
  1603.  
  1604. ' set the next series' properties
  1605. Set curSeries = objRCComboGraph.GetSeries(4)
  1606. curSeries.Style = ROUNDED_RIBBON
  1607. curSeries.Material.DiffuseColorField.Value = &HAA84A2
  1608. curSeries.Material.ShininessField.Value = 0.8
  1609. curSeries.PopupProps.UsePopups = True
  1610. curSeries.PopupProps.Alignment = VRML_RIGHT
  1611. curSeries.PopupProps.TextHeight = 0.5
  1612. curSeries.PopupProps.BorderColor = vbBlack
  1613. curSeries.PopupProps.TextColor = vbBlack
  1614. curSeries.PopupProps.BackgroundColor = &HAEDFD7
  1615. tempHeight = objRCComboGraph.GridProps.Height * 0.2
  1616. For i = 1 To objRCComboGraph.GridProps.XAxisCellCount
  1617.     tempHeight = tempHeight + (Rnd() * 2#) - 1#
  1618.     If tempHeight < 0.5 Then
  1619.         tempHeight = 0.5
  1620.     ElseIf tempHeight > (objRCComboGraph.GridProps.Height - 0.5) Then
  1621.         tempHeight = objRCComboGraph.GridProps.Height - 0.5
  1622.     End If
  1623.     Call curSeries.Height.AddValue(tempHeight)
  1624.     Call curSeries.PopupProps.PopupText.AddValue(Format((tempHeight * scaler), "#0.00"))
  1625. Next i
  1626. curSeries.LegendText = "Fourth series"
  1627. curSeries.Depth = 0.6
  1628. curSeries.Thickness = 0.3
  1629. curSeries.Style = ROUNDED_RIBBON
  1630. curSeries.BevelRadius = 0.1
  1631.  
  1632. objRCComboGraph.SurfaceCount = 1
  1633.  
  1634. scaler = 15# / 8#
  1635. ' set the first surface's properties
  1636. Set curSurface = objRCComboGraph.GetSurface(1)
  1637. curSurface.Material.DiffuseColorField.Value = &HFFFFFA
  1638. curSurface.Material.TransparencyField.Value = 0.5
  1639. curSurface.LegendText = "Primary surface"
  1640. curSurface.WireColor = &H0
  1641. curSurface.PopupProps.UsePopups = True
  1642. curSurface.PopupProps.TextHeight = 0.5
  1643. curSurface.PopupProps.BorderColor = vbBlack
  1644. curSurface.PopupProps.TextColor = vbBlack
  1645. curSurface.PopupProps.BackgroundColor = &HAEDFD7
  1646. For j = 1 To objRCComboGraph.GridProps.ZAxisCellCount
  1647.     If j = 1 Then
  1648.         tempHeight = objRCComboGraph.GridProps.Height * 0.6
  1649.     ElseIf j = 2 Then
  1650.         tempHeight = objRCComboGraph.GridProps.Height * 0.5
  1651.     ElseIf j = 3 Then
  1652.         tempHeight = objRCComboGraph.GridProps.Height * 0.2
  1653.     ElseIf j = 4 Then
  1654.         tempHeight = objRCComboGraph.GridProps.Height * 0.1
  1655.     End If
  1656.     For i = 1 To objRCComboGraph.GridProps.XAxisCellCount
  1657.         tempHeight = tempHeight + (Rnd() * 1#) - 0.5
  1658.         If tempHeight < 0.2 Then
  1659.             tempHeight = 0.2
  1660.         ElseIf tempHeight > (objRCComboGraph.GridProps.Height - 0.5) Then
  1661.             tempHeight = objRCComboGraph.GridProps.Height - 0.5
  1662.         End If
  1663.         tempText = Format((tempHeight * scaler), "#0.00")
  1664.         Call curSurface.Set1HeightPoint(i, j, tempHeight, tempText)
  1665.     Next i
  1666. Next j
  1667.  
  1668. ' now make the viewpoint
  1669. Set objView = objRCComboGraph.Viewpoints.AddViewpoint
  1670. objView.DescriptionField.Value = "Initial view point"
  1671. Call objView.PositionField.SetValues(6, 4, 20)
  1672. Call objView.OrientationField.SetEulerValues(-0.05, 0.05, 0)
  1673.  
  1674. ' export to a file
  1675. Call objRCComboGraph.ExportToFile(App.Path & "\RCComboGraphTest.wrl")
  1676. Call AlertComplete(App.Path & "\RCComboGraphTest.wrl")
  1677.  
  1678. End Sub
  1679.  
  1680. Private Sub Form_Load()
  1681.  
  1682. Debug.Print PortalTemplateCtl.RelativeProtoPath
  1683.  
  1684. End Sub
  1685.  
  1686. Public Sub AlertComplete(ByVal fName As String)
  1687. Dim retVal As Boolean
  1688. Dim msgStr  As String
  1689.  
  1690. msgStr = "Created file " & fName & Chr(13) & Chr(10)
  1691. msgStr = msgStr & "Open in default browser?"
  1692. retVal = MsgBox(msgStr, vbYesNo, "Portal Test")
  1693. If retVal = True Then
  1694.     Screen.MousePointer = vbHourglass
  1695.     Call ShellExecute(hwnd, "open", fName, vbNullString, vbNullString, SW_NORMAL)
  1696.     Screen.MousePointer = vbArrow
  1697. End If
  1698.  
  1699. End Sub
  1700.